using System;
using System.Collections.Generic;
using System.Text;
using Barrage.Language;
using Barrage.Meshes.Text;
using Spacedash.Logic;
using SlimDX;
using Barrage;

namespace Spacedash.Game.Items
{
    class GUIShipPosition : Item
    {
        const string POSITION = "POSITION";
        public const float SIZE_X = 175;
        public const float SIZE_Y = 50;
        TextBoxMesh textBoxMesh;
        Ship ship;
        Race race;
        public GUIShipPosition(Vector2 position, Race race, Ship ship)
        {
            this.ship = ship;
            this.race = race;
            motion.Translation = new Vector3(position, 0);
            TextBoxDrawProperties tbdp = new TextBoxDrawProperties(TextAlignment.Center, new Vector2(SIZE_X, SIZE_Y), 0.33f, VerticalAlignment.Top, Vector2.Zero);
            textBoxMesh = new TextBoxMesh(BitmapFontManager.Fonts["Standard"], tbdp);
            textBoxMesh.FirstMaterial.Diffuse = (Color4)ship.Color;
            addMesh(textBoxMesh);
        }

        protected override void DoUpdate()
        {
            textBoxMesh.Text = LanguageManager.Texts[POSITION] + "\n" + (ship.RacePosition+1).ToString() + " / " + race.PlayerNumber.ToString();
            base.DoUpdate();
        }
    }
}
